/*
 * @Author: “ygnnli” “1585923072@qq.com”
 * @Date: 2024-08-03 11:33:45
 * @LastEditors: “ygnnli” “1585923072@qq.com”
 * @LastEditTime: 2024-08-03 17:46:57
 * @FilePath: /110/46/udp_echo_server/Main.cc
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
#include <iostream>
#include "UdpServer.hpp"
#include <memory>

// 输入格式不对
void Usage(std::string proc)
{
    std::cout << "Usage: \n\t" << proc << "local_port\n"
              << std::endl;
}

// ./udpserver 需要传入和 port
int main(int arg, char *argv[])
{
    if (arg != 2)
    {
        Usage(argv[0]);
        exit(USAGE_ERROR);
    }
    EnableScreen(); // 开启终端回显
    // std::string ip = argv[1];      // 本地IP
    uint16_t port = atoi(argv[1]); // 本地端口

    std::unique_ptr<UdpServer> usvr = std::make_unique<UdpServer>(port); // c++14

    usvr->InitServer();

    usvr->Start();

    return 0;
}